﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using DAL;
using Model;
using IDAL;
using BLL;
/***************************
 * API
 * 
 * Author：JXL
 ***************************/ 
namespace EstateService.Controllers
{
    public class VillageController : ApiController
    {

        BLL.Factory<IVillageDAL, VillageDAL> bll = new Factory<IVillageDAL, VillageDAL>();
        // GET api/village
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/village/5
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Village Get(int id)
        {
            string wherestr = "projectNumber=" + id + "";
            return bll.bll().getmodel<Village>(wherestr);
        }

        // POST api/village
        public void Post([FromBody]string value)
        {
        }

        // PUT api/village/5
        public int Put(int id, [FromBody]Village value)
        {
            string wherestr = "projectNumber=" + id + "";
            value.village_CreateTime = DateTime.Now;
            return bll.bll().updates<Village>(value, wherestr);
        }

        // DELETE api/village/5
        public void Delete(int id)
        {
        }

        [HttpPost]
        [ActionName("VillageAdd")]
        public int VillageAdd(Village mo)
        {
            return bll.Fbi().VillageAdd(mo);
        }
    }
}
